package com.mszlu.blog.component;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Set;

//让spring可以扫描到它
@Configuration
public class RabbitMQListener {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;

    @RabbitListener(queues = {"mq.cache"})
    public void listenSimpleQueue(Set keys){
//        System.out.println("消费者接收到simple.queue的消息: [ " + keys + " ]");
        redisTemplate.delete(keys);
    }
}
